{
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
}
var
	a:array[0..1001] of char;
	t:char;
	i:integer=0;
begin
	while true do
	begin
		read(t);
		if ((ord('A')<=ord(t)) and (ord(t)<=ord('Z'))) or (((ord('a')<=ord(t)) and (ord(t)<=ord('z')))) then
		begin
			a[i]:=t;
			inc(i);
		end
		else
		begin
			dec(i);
			while (i>=0) do
			begin
				write(a[i]);
				dec(i);
			end;
			write(t);
			i:=0;
			if eoln then
				break;
		end;
	end;
end.
